
package org.onion.pattern.domain.annotation;

import java.lang.annotation.*;

/**
 * Identifies a DDD module.
 *
 * @see <a href="https://domainlanguage.com/wp-content/uploads/2016/05/DDD_Reference_2015-03.pdf">Domain-Driven Design
 *      Reference (Evans) - Modules</a>
 */
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.PACKAGE, ElementType.ANNOTATION_TYPE })
@Documented
public @interface Module {

	/**
	 * A stable identifier for the module. If not defined, an identifier will be derived from the annotated element,
	 * usually a package. That allows tooling to derive name and description by applying some kind of convention to the
	 * identifier.
	 * <p>
	 * Assuming a package {@code com.acme.myapp.module} annotated with {@code Module}, tooling could use a resource bundle
	 * to lookup the keys {@code com.acme.myapp.module._name} and {@code com.acme.myapp.module_description} to resolve
	 * name and description respectively.
	 *
	 * @return
	 */
	String id() default "";

	/**
	 * A human readable name for the module. Might be overridden by an external resolution mechanism via {@link #id()}.
	 * Tooling should prevent both {@link #value()} and {@link #name()} from being configured at the same time. If in
	 * doubt, the value defined in {@link #name()} will be preferred.
	 *
	 * @return
	 * @see #id()
	 */
	String name() default "";

	/**
	 * An alias for {@link #name()}. Tooling should prevent both {@link #value()} and {@link #name()} from being
	 * configured at the same time. If in doubt, the value defined in {@link #name()} will be preferred.
	 *
	 * @return
	 * @see #name()
	 */
	String value() default "";

	/**
	 * A human readable description for the module. Might be overridden by an external resolution mechanism via
	 * {@link #id()}.
	 *
	 * @return
	 * @see #id()
	 */
	String description() default "";
}
